package cn.edu.xhu.library_management.user.service.impl;

import cn.edu.xhu.library_management.user.entity.dto.ReservationSeatDTO;
import cn.edu.xhu.library_management.user.utils.DateUtils;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import cn.edu.xhu.library_management.user.entity.LmReservationSeat;
import cn.edu.xhu.library_management.user.service.LmReservationSeatService;
import cn.edu.xhu.library_management.user.mapper.LmReservationSeatMapper;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

/**
* @author 21086
* @description 针对表【lm_reservation_seat(预约座位表)】的数据库操作Service实现
* @createDate 2023-04-26 21:20:44
*/
@Service
public class LmReservationSeatServiceImpl extends ServiceImpl<LmReservationSeatMapper, LmReservationSeat>
    implements LmReservationSeatService{

    @Override
    public List<LmReservationSeat> reservationSeatNow(ReservationSeatDTO reservationSeat) {

        QueryWrapper<LmReservationSeat> queryWrapper = new QueryWrapper<>();

        // 图书馆
        queryWrapper.lambda().eq(LmReservationSeat::getRsInfoid,reservationSeat.getInfoId());
        // 楼层
        queryWrapper.lambda().eq(LmReservationSeat::getRsFloorid,reservationSeat.getFloorId());
        // 区域
        queryWrapper.lambda().eq(LmReservationSeat::getRsAreaid,reservationSeat.getAreaId());
        // 已经预约
        queryWrapper.lambda().eq(LmReservationSeat::getRsStatus,"1");
        System.out.println(DateUtils.strCoverDate(reservationSeat.getDate(),"yyyy.MM.dd"));
        // 当前天数
        queryWrapper.lambda().eq(LmReservationSeat::getRsDate, DateUtils.strCoverDate(reservationSeat.getDate(),"yyyy.MM.dd"));

        return  this.list(queryWrapper);
    }
}




